<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>rrdtool</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>rrdtool - Round Robin Database Tool</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p><b>rrdtool</b> <b>-</b> [workdir]| <i>function</i></p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<h2 id="OVERVIEW">OVERVIEW</h2>

<p>It is pretty easy to gather status information from all sorts of things, ranging from the temperature in your office to the number of octets which have passed through the FDDI interface of your router. But it is not so trivial to store this data in an efficient and systematic manner. This is where <b>RRDtool</b> comes in handy. It lets you <i>log and analyze</i> the data you gather from all kinds of data-sources (<b>DS</b>). The data analysis part of RRDtool is based on the ability to quickly generate graphical representations of the data values collected over a definable time period.</p>

<p>In this man page you will find general information on the design and functionality of the Round Robin Database Tool (RRDtool). For a more detailed description of how to use the individual functions of <b>RRDtool</b> check the corresponding man page.</p>

<p>For an introduction to the usage of RRDtool make sure you consult the <a href="./rrdtutorial.html">rrdtutorial</a>.</p>

<h2 id="FUNCTIONS">FUNCTIONS</h2>

<p>While the man pages talk of command line switches you have to set in order to make <b>RRDtool</b> work it is important to note that <b>RRDtool</b> can be remotely controlled through a set of pipes. This saves a considerable amount of startup time when you plan to make <b>RRDtool</b> do a lot of things quickly. Check the section on <a href="#REMOTE-CONTROL">&quot;REMOTE CONTROL&quot;</a> further down. There is also a number of language bindings for RRDtool which allow you to use it directly from Perl, python, Tcl, PHP, etc.</p>

<dl>

<dt id="create"><b>create</b></dt>
<dd>

<p>Set up a new Round Robin Database (RRD). Check <a href="./rrdcreate.html">rrdcreate</a>.</p>

</dd>
<dt id="update"><b>update</b></dt>
<dd>

<p>Store new data values into an RRD. Check <a href="./rrdupdate.html">rrdupdate</a>.</p>

</dd>
<dt id="updatev"><b>updatev</b></dt>
<dd>

<p>Operationally equivalent to <b>update</b> except for output. Check <a href="./rrdupdate.html">rrdupdate</a>.</p>

</dd>
<dt id="graph"><b>graph</b></dt>
<dd>

<p>Create a graph from data stored in one or several RRDs. Apart from generating graphs, data can also be extracted to stdout. Check <a href="./rrdgraph.html">rrdgraph</a>.</p>

</dd>
<dt id="graphv"><b>graphv</b></dt>
<dd>

<p>Create a graph from data stored in one or several RRDs. Same as graph, but metadata are printed before the graph. Check <a href="./rrdgraph.html">rrdgraph</a>.</p>

</dd>
<dt id="dump"><b>dump</b></dt>
<dd>

<p>Dump the contents of an RRD in plain ASCII. In connection with restore you can use this to move an RRD from one computer architecture to another. Check <a href="./rrddump.html">rrddump</a>.</p>

</dd>
<dt id="restore"><b>restore</b></dt>
<dd>

<p>Restore an RRD in XML format to a binary RRD. Check <a href="./rrdrestore.html">rrdrestore</a></p>

</dd>
<dt id="fetch"><b>fetch</b></dt>
<dd>

<p>Get data for a certain time period from a RRD. The graph function uses fetch to retrieve its data from an RRD. Check <a href="./rrdfetch.html">rrdfetch</a>.</p>

</dd>
<dt id="tune"><b>tune</b></dt>
<dd>

<p>Alter setup and structure of an RRD. Check <a href="./rrdtune.html">rrdtune</a>.</p>

</dd>
<dt id="first"><b>first</b></dt>
<dd>

<p>Find the first update time of an RRD. Check <a href="./rrdfirst.html">rrdfirst</a>.</p>

</dd>
<dt id="last"><b>last</b></dt>
<dd>

<p>Find the last update time of an RRD. Check <a href="./rrdlast.html">rrdlast</a>.</p>

</dd>
<dt id="lastupdate"><b>lastupdate</b></dt>
<dd>

<p>Find the last update time of an RRD. It also returns the value stored for each datum in the most recent update. Check <a href="./rrdlastupdate.html">rrdlastupdate</a>.</p>

</dd>
<dt id="info"><b>info</b></dt>
<dd>

<p>Get information about an RRD. Check <a href="./rrdinfo.html">rrdinfo</a>.</p>

</dd>
<dt id="resize"><b>resize</b></dt>
<dd>

<p>Change the size of individual RRAs. This is dangerous! Check <a href="./rrdresize.html">rrdresize</a>.</p>

</dd>
<dt id="xport"><b>xport</b></dt>
<dd>

<p>Export data retrieved from one or several RRDs. Check <a href="./rrdxport.html">rrdxport</a>.</p>

</dd>
<dt id="flushcached"><b>flushcached</b></dt>
<dd>

<p>Flush the values for a specific RRD file from memory. Check <a href="./rrdflushcached.html">rrdflushcached</a>.</p>

</dd>
<dt id="list"><b>list</b></dt>
<dd>

<p>List the directories and rrd databases remotely. Check <a href="./rrdlist.html">rrdlist</a>.</p>

</dd>
</dl>

<h2 id="HOW-DOES-RRDTOOL-WORK">HOW DOES RRDTOOL WORK?</h2>

<dl>

<dt id="Data-Acquisition">Data Acquisition</dt>
<dd>

<p>When monitoring the state of a system, it is convenient to have the data available at a constant time interval. Unfortunately, you may not always be able to fetch data at exactly the time you want to. Therefore <b>RRDtool</b> lets you update the log file at any time you want. It will automatically interpolate the value of the data-source (<b>DS</b>) at the latest official time-slot (interval) and write this interpolated value to the log. The original value you have supplied is stored as well and is also taken into account when interpolating the next log entry.</p>

</dd>
<dt id="Consolidation">Consolidation</dt>
<dd>

<p>You may log data at a 1 minute interval, but you might also be interested to know the development of the data over the last year. You could do this by simply storing the data in 1 minute intervals for the whole year. While this would take considerable disk space it would also take a lot of time to analyze the data when you wanted to create a graph covering the whole year. <b>RRDtool</b> offers a solution to this problem through its data consolidation feature. When setting up a Round Robin Database (<b>RRD</b>), you can define at which interval this consolidation should occur, and what consolidation function (<b>CF</b>) (average, minimum, maximum, last) should be used to build the consolidated values (see rrdcreate). You can define any number of different consolidation setups within one <b>RRD</b>. They will all be maintained on the fly when new data is loaded into the <b>RRD</b>.</p>

</dd>
<dt id="Round-Robin-Archives">Round Robin Archives</dt>
<dd>

<p>Data values of the same consolidation setup are stored into Round Robin Archives (<b>RRA</b>). This is a very efficient manner to store data for a certain amount of time, while using a known and constant amount of storage space.</p>

<p>It works like this: If you want to store 1&#39;000 values in 5 minute interval, <b>RRDtool</b> will allocate space for 1&#39;000 data values and a header area. In the header it will store a pointer telling which slots (value) in the storage area was last written to. New values are written to the Round Robin Archive in, you guessed it, a round robin manner. This automatically limits the history to the last 1&#39;000 values (in our example). Because you can define several <b>RRA</b>s within a single <b>RRD</b>, you can setup another one, for storing 750 data values at a 2 hour interval, for example, and thus keep a log for the last two months at a lower resolution.</p>

<p>The use of <b>RRA</b>s guarantees that the <b>RRD</b> does not grow over time and that old data is automatically eliminated. By using the consolidation feature, you can still keep data for a very long time, while gradually reducing the resolution of the data along the time axis.</p>

<p>Using different consolidation functions (<b>CF</b>) allows you to store exactly the type of information that actually interests you: the maximum one minute traffic on the LAN, the minimum temperature of your wine cellar, ... etc.</p>

</dd>
<dt id="Unknown-Data">Unknown Data</dt>
<dd>

<p>As mentioned earlier, the <b>RRD</b> stores data at a constant interval. Sometimes it may happen that no new data is available when a value has to be written to the <b>RRD</b>. Data acquisition may not be possible for one reason or other. With <b>RRDtool</b> you can handle these situations by storing an <i>*UNKNOWN*</i> value into the database. The value &#39;<i>*UNKNOWN*</i>&#39; is supported through all the functions of the tool. When consolidating a data set, the amount of <i>*UNKNOWN*</i> data values is accounted for and when a new consolidated value is ready to be written to its Round Robin Archive (<b>RRA</b>), a validity check is performed to make sure that the percentage of unknown values in the data point is above a configurable level. If not, an <i>*UNKNOWN*</i> value will be written to the <b>RRA</b>.</p>

</dd>
<dt id="Graphing">Graphing</dt>
<dd>

<p><b>RRDtool</b> allows you to generate reports in numerical and graphical form based on the data stored in one or several <b>RRD</b>s. The graphing feature is fully configurable. Size, color and contents of the graph can be defined freely. Check <a href="./rrdgraph.html">rrdgraph</a> for more information on this.</p>

</dd>
<dt id="Aberrant-Behavior-Detection">Aberrant Behavior Detection</dt>
<dd>

<p>by Jake Brutlag</p>

<p><b>RRDtool</b> provides the building blocks for near real-time aberrant behavior detection. These components include:</p>

<ul>

<li><p>An algorithm for predicting the value of a time series one time step into the future.</p>

</li>
<li><p>A measure of deviation between predicted and observed values.</p>

</li>
<li><p>A mechanism to decide if and when an observed value or sequence of observed values is <i>too deviant</i> from the predicted value(s).</p>

</li>
</ul>

<p>Here is a brief explanation of these components:</p>

<p>The Holt-Winters time series forecasting algorithm is an on-line (or incremental) algorithm that adaptively predicts future observations in a time series. Its forecast is the sum of three components: a baseline (or intercept), a linear trend over time (or slope), and a seasonal coefficient (a periodic effect, such as a daily cycle). There is one seasonal coefficient for each time point in the period (cycle). After a value is observed, each of these components is updated via exponential smoothing. This means that the algorithm &quot;learns&quot; from past values and uses them to predict the future. The rate of adaptation is governed by 3 parameters, alpha (intercept), beta (slope), and gamma (seasonal). The prediction can also be viewed as a smoothed value for the time series.</p>

<p>The measure of deviation is a seasonal weighted absolute deviation. The term <i>seasonal</i> means deviation is measured separately for each time point in the seasonal cycle. As with Holt-Winters forecasting, deviation is predicted using the measure computed from past values (but only at that point in the seasonal cycle). After the value is observed, the algorithm learns from the observed value via exponential smoothing. Confidence bands for the observed time series are generated by scaling the sequence of predicted deviation values (we usually think of the sequence as a continuous line rather than a set of discrete points).</p>

<p>Aberrant behavior (a potential failure) is reported whenever the number of times the observed value violates the confidence bands meets or exceeds a specified threshold within a specified temporal window (e.g. 5 violations during the past 45 minutes with a value observed every 5 minutes).</p>

<p>This functionality is embedded in a set of related <b>RRAs</b>. In particular, a FAILURES <b>RRA</b> logs potential failures. With these data you could, for example, use a front-end application to <b>RRDtool</b> to initiate real-time alerts.</p>

<p>For a detailed description on how to set this up, see <a href="./rrdcreate.html">rrdcreate</a>.</p>

</dd>
</dl>

<h2 id="REMOTE-CONTROL">REMOTE CONTROL</h2>

<p>When you start <b>RRDtool</b> with the command line option &#39;<b>-</b>&#39; it waits for input via standard input (STDIN). With this feature you can improve performance by attaching <b>RRDtool</b> to another process (MRTG is one example) through a set of pipes. Over these pipes <b>RRDtool</b> accepts the same arguments as on the command line and some special commands like <b>cd, mkdir, pwd, ls</b> and <b>quit</b>. For detailed help on the server commands type:</p>

<pre><code>   rrdtool help cd</code></pre>

<p>When a command is completed, RRDtool will print the string &#39;<code>OK</code>&#39;, followed by timing information of the form <b>u:</b><i>usertime</i> <b>s:</b><i>systemtime</i><b>r:</b><i>runtime</i>. The <i>usertime</i> and <i>systemtime</i> values are the running totals of seconds since RRDtool was started. <i>runtime</i> is the total amount of seconds that RRDtool has been running. If an error occurs, a line of the form &#39;<code>ERROR:</code> <i>Description of error</i>&#39; will be printed instead. <b>RRDtool</b> will not abort, unless something really serious happens. If a <b>workdir</b> is specified and the UID is 0, RRDtool will do a chroot to that workdir. If the UID is not 0, RRDtool only changes the current directory to <b>workdir</b>.</p>

<h2 id="RRD-Server">RRD Server</h2>

<p>If you want to create a RRD-Server, you must choose a TCP/IP Service number and add them to <i>/etc/services</i> like this:</p>

<pre><code> rrdsrv      13900/tcp                       # RRD server</code></pre>

<p>Attention: the TCP port 13900 isn&#39;t officially registered for rrdsrv. You can use any unused port in your services file, but the server and the client system must use the same port, of course.</p>

<p>With this configuration you can add RRDtool as meta-server to <i>/etc/inetd.conf</i>. For example:</p>

<pre><code> rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd</code></pre>

<p>Don&#39;t forget to create the database directory /var/rrd and reinitialize your inetd.</p>

<p>If all was setup correctly, you can access the server with Perl sockets, tools like netcat, or in a quick interactive test by using &#39;telnet localhost rrdsrv&#39;.</p>

<p><b>NOTE:</b> that there is no authentication with this feature! Do not setup such a port unless you are sure what you are doing.</p>

<h1 id="ENVIRONMENT-VARIABLES">ENVIRONMENT VARIABLES</h1>

<p>The following environment variables may be used to change the behavior of most of the utilities.</p>

<dl>

<dt id="RRD_LOCKING"><b>RRD_LOCKING</b></dt>
<dd>

<p>If this environment variable is set, the <b>RRD</b> file is locked in the given mode:</p>

<dl>

<dt id="pod">-</dt>
<dd>

<p><b>try</b> fails, when the file is locked by another process. This is the default.</p>

</dd>
<dt id="pod1">-</dt>
<dd>

<p><b>block</b> waits until the lock is released.</p>

</dd>
<dt id="pod2">-</dt>
<dd>

<p><b>none</b> skips locking at all. Caller has to ensure a proper locking which should be compatible with <code>fcntl(fd, F_SETLK, ...)</code>.</p>

</dd>
</dl>

<p>Some utilities have command line options (<b>--locking</b>) which override this variable.</p>

</dd>
</dl>

<h1 id="RRDCACHED-THE-CACHING-DAEMON">RRDCACHED, THE CACHING DAEMON</h1>

<p>For very big setups, updating thousands of RRD files often becomes a serious IO problem. If you run into such problems, you might want to take a look at <a href="./rrdcached.html">rrdcached</a>, a caching daemon for RRDtool which may help you lessen the stress on your disks.</p>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p>rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport, rrdflushcached, rrdcached</p>

<h1 id="BUGS">BUGS</h1>

<p>Bugs? Features!</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Tobias Oetiker &lt;tobi@oetiker.ch&gt;</p>


</body>

</html>


